package apiv1

import (
	"github.com/gin-gonic/gin"
	"go-shop-api/internal/service"
	"net/http"
)

// SendEmail 发送email
func SendEmail(c *gin.Context) {
	var sendEmail service.SendEmailService

	//验证
	if err := c.ShouldBind(&sendEmail); err != nil {
		//返回验证器验证的错误信息
		c.JSON(http.StatusOK, Validators(err))
		return
	}
	res := sendEmail.SendEmail(c.Request.Context(), GetUid(c))
	c.JSON(http.StatusOK, res)
}

// ValidEmail 验证
func ValidEmail(c *gin.Context) {
	var validEmail service.ValidEmailService
	res := validEmail.ValidEmail(c.Request.Context(), c.Param("token"))
	c.JSON(http.StatusOK, res)
}
